cmake_minimum_required(VERSION 3.16)

project(deepseek-api-dome1 LANGUAGES C)

# 查找必要的包
find_package(CURL REQUIRED)
find_package(PkgConfig REQUIRED)

# 添加cJSON源文件
include(FetchContent)
FetchContent_Declare(
    cJSON
    GIT_REPOSITORY https://github.com/DaveGamble/cJSON.git
    GIT_TAG v1.7.15
)
FetchContent_MakeAvailable(cJSON)

# 添加可执行文件
add_executable(deepseek-api-dome1 main.c)

# 添加include目录
target_include_directories(deepseek-api-dome1 PRIVATE ${cjson_SOURCE_DIR})

# 链接依赖库
target_link_libraries(deepseek-api-dome1 PRIVATE CURL::libcurl cjson)

include(GNUInstallDirs)
install(TARGETS deepseek-api-dome1
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)